home *** CD-ROM | disk | FTP | other *** search
/ Inventor Labs: Technology / INVENTORLABS_TECHNOLOGY.BIN / pc / files / gears.dir / 00211_Script_Gear Parent < prev    next >
Text File  |  1997-05-26  |  3KB  |  96 lines

  1. --o Gear parent
  2.  
  3.  
  4.  
  5. -- gGearMgrParent
  6.  
  7. property pStartCast, pEndCast, pNumOfIncrements, pSpriteNum, pDirection
  8. property pCurrCast, pGearHorz, pGearVert, pSize, pAvailibleSlots
  9.  
  10.  
  11. ------------------------------------------------------------------------------------------------------------
  12. on Birth me, WhatSize,CastLst, spritenum, Direction, StartCast, AjoiningEdge, Neighbor
  13.   
  14.   set pStartCast = getat(CastLst,1)
  15.   set pEndCast = getat(CastLst,2)
  16.   set pNumOfIncrements = pEndCast - pStartCast
  17.   set pSpriteNum = spritenum
  18.   set pDirection = Direction
  19.   set pSize = WhatSize
  20.   
  21.   set pGearHorz = the loch of sprite pSpriteNum
  22.   set pGearVert = the locv of sprite pSpriteNum
  23.   set pCurrCast = StartCast
  24.   set pAvailibleSlots = [1,1,1,1]
  25.   setat ( pAvailibleSlots, AjoiningEdge,Neighbor)
  26.   puppetsprite pSpriteNum, TRUE
  27.   set the castnum of sprite pSpriteNum = pCurrCast
  28.   
  29.   return( me )
  30.   
  31. end Birth
  32. ------------------------------------------------------------------------------------------------------------
  33. on mPerform me
  34.   
  35.   set pCurrCast = pCurrCast + pDirection
  36.   if (pCurrCast > pEndCast) then set pCurrCast = pStartCast
  37.   else if (pCurrCast < pStartCast) then set pCurrCast = pEndCast
  38.   set the castnum of sprite pSpriteNum = pCurrCast
  39.   
  40. end mPerform
  41. ------------------------------------------------------------------------------------------------------------
  42. on mInformNeighbors me
  43.  
  44.   set whatpos = 1
  45.   repeat with Neighbor in pAvailibleSlots
  46.  
  47.     if objectp( Neighbor ) then 
  48.       set NeighborViewPos = (whatpos  + 2) Mod 5
  49.       if NeighborViewPos = 0 then set NeighborViewPos = 1
  50.       mClearNeighbor (Neighbor, me)
  51.     end if
  52.     set whatpos = whatpos + 1
  53.  
  54.   end repeat
  55.   
  56. end mInformNeighbors
  57. ------------------------------------------------------------------------------------------------------------
  58. on mGetNeighborCords me
  59.   
  60.   set Step = (pCurrCast - pStartCast) mod 3
  61.   set GearDescription = [pGearHorz,pGearVert,pSize, Step,pAvailibleSlots]
  62.   return( GearDescription )
  63.   
  64. end mSnapNeighbor
  65. ------------------------------------------------------------------------------------------------------------
  66. on mGetRect me
  67.   
  68.   return( the rect of sprite pSpriteNum )
  69.   
  70. end mGetRect
  71. ------------------------------------------------------------------------------------------------------------
  72. on mGetDirection me
  73.   
  74.   return( pDirection )
  75.   
  76. end mGetDirection
  77. ------------------------------------------------------------------------------------------------------------
  78. on mSetNeighbor me, WhatSide, who
  79.   
  80.   setat( pAvailibleSlots, WhatSide, who)
  81.  
  82. end mSetNeighbor
  83. ------------------------------------------------------------------------------------------------------------
  84. on mClearNeighbor me, who
  85.   
  86.  set whatpos = getpos( pAvailibleSlots, who)
  87.  setat (pAvailibleSlots,Whatpos,1)
  88.  
  89. end mClearNeighbor
  90. ------------------------------------------------------------------------------------------------------------
  91. on mClearAllNeighbor me
  92.   
  93.   set pAvailibleSlots = [1,1,1,1]
  94.   
  95. end mClearNeighbor
  96. ------------------------------------------------------------------------------------------------------------